<template>
  <view class="advise">
    <scroll-view 
        style="height: 100%; box-sizing: border-box;" 
        :scroll-y="true"
    >
    <AtList :hasBorder="false">
        <AtListItem
          :hasBorder="true"
          v-for="item in complaint_list"
          arrow='right'
          @click="gotoQD(item)"
          :note='item.c_complaint_time'
          :title='item.c_complaint_content'
        />
    </AtList>
    </scroll-view>
  </view>
</template>

<script setup>
import { AtListItem,AtList } from 'taro-ui-vue3'
import './index.scss'
import Taro, {useDidShow} from '@tarojs/taro'
import {ref} from 'vue'
import { add_complaint, query_complaint_list } from  '../../http/api'

const complaint_list = ref([])
// 跳转问题答案
const gotoQD = (row) => {
  Taro.navigateTo({
    url: `/pages/questionDetail/index?question=${row.c_complaint_content}&anstwer=${row.c_return_result || '暂未处理，请耐心等待~'}`
  })
}
const query_complaint = () => {
  query_complaint_list({page: 1, page_size: 100}).then(res => {
    if(res.code == '1000') {
      complaint_list.value = res.data.data_list
    }
  })
}
useDidShow(() => {
  query_complaint()
})
Taro.showShareMenu({
  withShareTicket: true,
  menus: ['shareAppMessage', 'shareTimeline']
})
</script>
